package com.frogs.ucenter.v1.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.frogs.framework.base.web.BaseController3;
import com.frogs.system.web.api.response.FailResponse;
import com.frogs.system.web.api.response.Response;
import com.frogs.system.web.exception.AppBaseException;
import com.frogs.ucenter.v1.request.UserRemindedInfoAddRequest;
import com.frogs.ucenter.v1.service.UserRemindedInfoService;
import com.frogs.ucenter.v1.util.ApiConstants;

@Controller(ApiConstants.VERSION + "userRemindedInfoController")
@RequestMapping("/" + ApiConstants.VERSION )
public class UserRemindedInfoController extends BaseController3 {

	/** 提醒家人测量,ajax*/
	private static final String USER_REMINDED = "/user/reminded";

	@Resource(name= ApiConstants.VERSION + "userRemindedInfoService")
    private UserRemindedInfoService userRemindedInfoService;

	@RequestMapping(USER_REMINDED)
	public Response doRemind(HttpServletRequest request) {
		Response response = null ; 
		try{
			UserRemindedInfoAddRequest req = new UserRemindedInfoAddRequest();
			req.parse(request);
			response = userRemindedInfoService.doRtemind(req);
		}catch (Exception e) {
			response = new FailResponse();
			if (e instanceof AppBaseException) {
				response.setTip(e.getMessage());
			} else {
				response.setTip("errro message" + e.getMessage());
			}
		}
		return response;
	}


}